package jobase

import "unsafe"

type InterfaceStructure struct {
	Pt uintptr
	Pv uintptr
}

func AsInterfaceStructure(obj any) InterfaceStructure {
	return *(*InterfaceStructure)(unsafe.Pointer(&obj))
}

func IsNilObject(obj any) bool {
	if obj == nil {
		return true
	}

	ptr := AsInterfaceStructure(obj)
	if ptr.Pv == 0 || ptr.Pt == 0 {
		return true
	}

	return false
}

func IsNotNilObject(obj any) bool {
	if obj == nil {
		return false
	}

	ptr := AsInterfaceStructure(obj)
	if ptr.Pv != 0 && ptr.Pt != 0 {
		return true
	} else {
		return false
	}
}

type IFixDefaultValue interface {
	FixDefaultValue() error
}
